package org.example.dfs;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liyishan
 * @date 2023/8/30 09:49
 * @apiNote
 */

public class Test00784LetterCasePermutation {
    public static void main(String[] args) {
        String s = "a1b2";
        List<String> res = test(s);
        System.out.println(JSON.toJSON(res));
    }

    public static List<String> test(String s) {
        List<String> ans = new ArrayList<String>();
        dfs(s.toCharArray(), 0, ans);
        return ans;
    }

    public static void dfs(char[] arr, int index, List<String> res) {
        if (index == arr.length) {
            res.add(new String(arr));
            return;
        }
        dfs(arr,index+1,res);
        if(Character.isLetter(arr[index])){
            arr[index] ^= 32;
            dfs(arr,index+1,res);
        }
    }
}
